package com.kcsj.service;

import com.kcsj.dao.MarkDownDao;
import com.kcsj.domain.MarkDown;
import com.kcsj.util.JdbcHelper;

import java.sql.Connection;
import java.sql.SQLException;
/**
 * @author 胡庆阳
 * 29th Nov. 2020
 */
public class MarkDownService {
    private static MarkDownDao markDownDao = MarkDownDao.getInstance();
    private static MarkDownService markDownService =new MarkDownService();
    private MarkDownService(){}
    public static MarkDownService getInstance(){
        return markDownService;
    }
    //Fate Grand MarkDown?
    public void add(MarkDown markDown) throws SQLException {
        Connection conn = JdbcHelper.getConn();
        boolean add = markDownDao.add(markDown, conn);
        JdbcHelper.close(conn);
    }
    public MarkDown find(Integer userId) throws SQLException {
        Connection conn = JdbcHelper.getConn();
        MarkDown markDown = markDownDao.find(userId,conn);
        JdbcHelper.close(conn);
        return markDown;
    }
}
